package com.ftg.learn.chapter08.dependency;

/**
 * @author kangjx
 * @createTime 2023/1/11
 */
public class A {

    private B b1;

    public A(){
        b1 = new B();
    }

    public B getB1() {
        return b1;
    }

    public void setB1(B b1) {
        this.b1 = b1;
    }

    public A(B b1){

    }

    public void test1(){
        b1.bMethod();
    }

    public void test2(){
        b1.bMethod();
    }
    public static void main(String[] args) {
        B b1 = new B();
        A a1 = new A();
        a1.setB1(b1);
        a1.test1();
        //解耦 ： 构造方法 组合的方式来完成  setter 才为变量赋值

    }
}
